<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>

        var i = 0
        var total = 0
        //先判断，再执行
        while (i <= 20) {
            // debugger  断点
            if (i % 2 === 0) {
                total = total + i
            }
            i++
        }

        console.log(total);


    </script>
</body>

</html>